package com.qinhailin.portal.business.ctrl;

import com.jfinal.aop.Inject;
import com.jfinal.core.Path;
import com.jfinal.plugin.activerecord.Record;
import com.qinhailin.common.base.BaseController;
import com.qinhailin.portal.business.model.ICustomerInfo;
import com.qinhailin.portal.business.service.ICustomerInfoService;

/**
 *
 * @author qinhailin
 * @date 2024-12-12
 */
@Path("/portal/business/personalHealthStatement")
public class PersonalHealthStatement extends BaseController {

    @Inject
    ICustomerInfoService service;

  	public void index(){
    	render("index2.html");
  	}

//    public void list() {
//        Record record=getAllParamsToRecord();
//        int pageNumber=getParaToInt("pageNumber", 1);
//        int pageSize=getParaToInt("pageSize", 10);
//        Grid g=service.page(pageNumber, pageSize,record);
//        renderJson(g);
//	}
    public void list(){
        Record record = getAllParamsToRecord();
        record.remove("pageSize","pageNumber");
        renderJson(service.queryForList(getParaToInt("pageNumber",1), getParaToInt("pageSize",10),record));
    }



    public void add() {
    	render("add.html");
    }

    public void save() {
        ICustomerInfo entity=getBean(ICustomerInfo.class);
    	entity.setId(createUUID());
    	entity.save();
    	setAttr("iCustomerInfo", entity);
    	render("add.html");
    }

    public void edit() {
        setAttr("iCustomerInfo", service.findById(getPara(0)));
        render("edit.html");
    }

    public void update() throws Exception {
        ICustomerInfo entity=getBean(ICustomerInfo.class);
        entity.update();
        setAttr("iCustomerInfo", entity);
        render("edit.html");
    }

    public void delete() {
        service.deleteByIds(getIds());
        renderJson(suc());
    }


    public void modify() {
        ICustomerInfo entity=getBean(ICustomerInfo.class);
        entity.setDevideid("");
        entity.update();
        setAttr("iCustomerInfo", entity);
        renderJson(suc());
    }
}
